home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / BORL_TIP / TI100 / TI674.ASC < prev    next >
Text File  |  1994-10-03  |  2KB  |  109 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.   PRODUCT  :  Pascal                                 NUMBER  :  674
  8.   VERSION  :  All
  9.        OS  :  DOS
  10.      DATE  :  September 30, 1994                       PAGE  :  1/2
  11.  
  12.     TITLE  :  Change Foreground and Background Color
  13.  
  14.  
  15.  
  16.  
  17. {
  18.  
  19. This program will place a new foreground and background color and
  20. pattern on the desktop.  It will also set the character that is
  21. displayed for the pattern.
  22.  
  23. This example: the $05 defines the 0 for black foreground and
  24. the 5 for purple background.
  25.  
  26. }
  27.  
  28. program ColorManipulation;
  29.  
  30. uses
  31.     Dos, Objects, Drivers, Memory, Views,
  32.     Menus, Dialogs, App;
  33. type
  34.   PMyBack = ^TMyBack;
  35.   TMyBack = object(TBackground)
  36.     constructor Init(var Bounds: TRect);
  37.   end;
  38.  
  39.   PMyApp = ^TMyApp;
  40.   TMyApp = object(TApplication)
  41.     MyBack: PMyBack;
  42.     constructor Init;
  43.     function GetPalette:PPalette; virtual;
  44.   end;
  45.  
  46. function TMyApp.GetPalette: PPalette;
  47. const
  48.   MyBackColor : TPalette = CColor;  { sets palette to CColor }
  49.                                     { items }
  50. begin
  51.   MyBackColor[1]:=#$05;   { TBackGround Color Constant's first }
  52.                           { number is background and second is }
  53.                           { foreground }
  54.   GetPalette := @MyBackColor;
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.   PRODUCT  :  Pascal                                 NUMBER  :  674
  68.   VERSION  :  All
  69.        OS  :  DOS
  70.      DATE  :  September 30, 1994                       PAGE  :  2/2
  71.  
  72.     TITLE  :  Change Foreground and Background Color
  73.  
  74.  
  75.  
  76.  
  77. end;
  78.  
  79. constructor TMyBack.Init(var Bounds: TRect);
  80. begin
  81.   TBackground.Init(Bounds, '▓');{ places ASCII 178 char as    }
  82.                                 { pattern for text on desktop }
  83. end;
  84.  
  85. constructor TMyApp.Init;
  86. var
  87.   R:TRect;
  88. begin
  89.   TApplication.Init;
  90.   GetExtent(R);
  91.   MyBack:= New(PMyBack, init(R));
  92.   Desktop^.Background:= MyBack;
  93.   Desktop^.Insert(Desktop^.Background);
  94. end;
  95.  
  96. var
  97.   TheApp: TMyApp;
  98. begin
  99.   TheApp.Init;
  100.   TheApp.Run;
  101.   TheApp.Done;
  102. end.
  103.  
  104.  
  105. DISCLAIMER: You have the right to use this technical information
  106. subject to the terms of the No-Nonsense License Statement that
  107. you received with the Borland product to which this information
  108. pertains.
  109.